package com.jfeat.am.module.wegou.task;

import com.jfeat.am.module.wegou.services.patch.DealExchangeRateService;
import org.slf4j.Logger;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;

/**
 * Created by Silent-Y on 2018/2/22.
 */
@Component
public class ScheduledTask {

    private static Logger logger = org.slf4j.LoggerFactory.getLogger(ScheduledTask.class);

    @Resource
    private DealExchangeRateService dealExchangeRateService;

    @Scheduled(cron = "0 0 6 * * ?")
//    @Scheduled(cron = "*/5 * * * * ?")
    public void saveExchangeRate() throws Exception{
        logger.info("start to get exchange rate now,{}",new Date());
        dealExchangeRateService.saveExchangeRate();
        logger.info("finish getting exchange rate now,{}",new Date());
    }

}
